package com.gitee.qdbp.general.common.api.settings.model;

import java.io.Serializable;
import java.util.Date;
import com.gitee.qdbp.base.annotation.DataIsolation;
import com.gitee.qdbp.base.annotation.OperateTraces;
import com.gitee.qdbp.general.common.enums.SensitiveLevel;
import com.gitee.qdbp.general.common.enums.SensitiveType;
import com.gitee.qdbp.general.common.enums.UsingState;

/**
 * 敏感词信息实体类
 *
 * @author zhh
 * @version 170802
 */
@OperateTraces(id = "id", desc = "word")
@DataIsolation("tenantCode")
public class SensitiveWordBean implements Serializable {

    /** 版本序列号 **/
    private static final long serialVersionUID = 1L;

    /** 表名 **/
    public static final String TABLE = "gn_sensitive_word";

    /** 敏感词ID **/
    private String id;

    /** 租户编号 **/
    private String tenantCode;

    /** 敏感词类型(0.默认) **/
    private SensitiveType type;

    /** 敏感词 **/
    private String word;

    /** 敏感级别(1.禁止|2.警告) **/
    private SensitiveLevel level;

    /** 例外组合 **/
    private String excludeList;

    /** 创建时间 **/
    private Date createTime;

    /** 启用状态(1.正常|2.未启用) **/
    private UsingState usingState;

    /** 获取敏感词ID **/
    public String getId() {
        return id;
    }

    /** 设置敏感词ID **/
    public void setId(String id) {
        this.id = id;
    }

    /** 获取租户编号 **/
    public String getTenantCode() {
        return tenantCode;
    }

    /** 设置租户编号 **/
    public void setTenantCode(String tenantCode) {
        this.tenantCode = tenantCode;
    }

    /** 获取敏感词类型(0.默认) **/
    public SensitiveType getType() {
        return type;
    }

    /** 设置敏感词类型(0.默认) **/
    public void setType(SensitiveType type) {
        this.type = type;
    }

    /** 获取敏感词 **/
    public String getWord() {
        return word;
    }

    /** 设置敏感词 **/
    public void setWord(String word) {
        this.word = word;
    }

    /** 获取敏感级别(1.禁止|2.警告) **/
    public SensitiveLevel getLevel() {
        return level;
    }

    /** 设置敏感级别(1.禁止|2.警告) **/
    public void setLevel(SensitiveLevel level) {
        this.level = level;
    }

    /** 获取例外组合 **/
    public String getExcludeList() {
        return excludeList;
    }

    /** 设置例外组合 **/
    public void setExcludeList(String excludeList) {
        this.excludeList = excludeList;
    }

    /** 获取创建时间 **/
    public Date getCreateTime() {
        return createTime;
    }

    /** 设置创建时间 **/
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    /** 获取启用状态(1.正常|2.未启用) **/
    public UsingState getUsingState() {
        return usingState;
    }

    /** 设置启用状态(1.正常|2.未启用) **/
    public void setUsingState(UsingState usingState) {
        this.usingState = usingState;
    }

    /**
     * 将当前对象转换为子类对象
     *
     * @param clazz 目标类型
     * @return 目标对象
     */
    public <T extends SensitiveWordBean> T to(Class<T> clazz) {
        T instance;
        try {
            instance = clazz.newInstance();
        } catch (Exception e) {
            throw new IllegalArgumentException("Failed to create " + clazz.getSimpleName() + " instance.", e);
        }

        instance.setId(this.getId()); // 敏感词ID
        instance.setTenantCode(this.getTenantCode()); // 租户编号
        instance.setType(this.getType()); // 敏感词类型(0.默认)
        instance.setWord(this.getWord()); // 敏感词
        instance.setLevel(this.getLevel()); // 敏感级别(1.禁止|2.警告)
        instance.setExcludeList(this.getExcludeList()); // 例外组合
        instance.setCreateTime(this.getCreateTime()); // 创建时间
        instance.setUsingState(this.getUsingState()); // 启用状态(1.正常|2.未启用)
        return instance;
    }

}